In the 9th century, was able to expel the Moors and founded a fortified town . The city is often referred to as the "birthplace of the Portuguese nationality" and also was the birthplace of Afonso I of Portugal, the first Portuguese king.